const express = require('express');
const router = express.Router();
router.get('/', (req, res) => {
    const content = [];
    for(let i = 0; i < 30; i++)
        content.push({
            id: `2019${i}`,
            vin: `VIN-2019-${i}`,
            vehicleProperty: 1,
            mileage: i,
            licensePlate: `车牌号${i}`,
            engineCode: `engineCode-${i}`,
            transmissionSn: `transmissionSn-${i}`,
            productionDate: '2019-09-12T11:27:39.715Z',
            saleDate: '2019-09-12T11:27:39.715Z',
            status: 1,
            salesDealerCode: `salesDealerCode-${i}`,
            salesDealerName: `salesDealerName-${i}`,
            customerName: `customerName-${i}`,
            cellPhoneNumber: `400-8888-${i}`
        });
    res.json({
        message: '',
        payload: {
            content,
        }
    });
});

router.get('/forCurrentUser', (req, res) => {
    const content = [];
    for(let i = 0; i < 30; i++)
        content.push({
            id: `2019${i}`,
            dealerId: '1',
            dealerCode: `DASFAGAWERFADS${i}`,
            dealerName: `奇瑞国际${i}`,
            subDealerCode: `ASFDASFDHSASF${i}`,
            subDealerName: `奇瑞${i}`,
            maintenanceNumber: 10,
            vin: `VIN-2019-${i}`,
            salesDate: '2019-09-25T06:37:45.115Z',
            mileage: 1235,
            rowVersion: 'string'
        });
    res.json({
        message: '',
        payload: {
            content,
            totalElements: 1000,
        }
    });
});

router.get('/detail', (req, res) => {
    res.json({
        message: '',
        payload: {
            content: {
                details: [
                    {
                        id: '001',
                        code: '',
                        dealerId: '1',
                        dealerCode: 'ASFRAGAGAGA',
                        dealerName: '奇瑞国际',
                        subDealerCode: 'GBCXGFBXNXX',
                        subDealerName: '奇瑞',
                        repairOrder: 'xzfaf-123541',
                        vin: 'VIN-12321',
                        salesDate: '2019-09-25T07:10:35.190Z',
                        maintainDate: '2019-09-25T07:10:35.190Z',
                        mileage: 132414,
                        remark: '备注',
                        createTime: '2019-09-25T07:10:35.190Z',
                        rowVersion: 'string',
                    },
                    {
                        id: '002',
                        code: '',
                        dealerId: '2',
                        dealerCode: 'ASFRAGAGAGA',
                        dealerName: '奇瑞国际',
                        subDealerCode: 'GBCXGFBXNXX',
                        subDealerName: '奇瑞',
                        repairOrder: 'xzfaf-123541',
                        vin: 'VIN-12321',
                        salesDate: '2019-09-25T07:10:35.190Z',
                        maintainDate: '2019-09-25T07:10:35.190Z',
                        mileage: 132414,
                        remark: '备注',
                        createTime: '2019-09-25T07:10:35.190Z',
                        rowVersion: 'string',
                    }
                ],
                activities: [
                    {
                        num: '001',
                        serviceName: '活动1',
                        isUsed: true,
                        attachments: [
                            {
                                fileId: '1',
                                fileName: '附件1'
                            },
                            {
                                fileId: '2',
                                fileName: '附件2'
                            }
                        ]
                    },
                    {
                        num: '002',
                        serviceName: '活动2',
                        isUsed: false,
                        attachments: []
                    }
                ]
            }
        }
    });
});

router.get('/simple', (req, res) => {
    const content = [];
    for(let i = 0; i < 10; i++)
        content.push({
            id: `2019${i}`,
            vin: `VIN-2019-${i}`,
            vehicleProperty: 1,
            mileage: i,
            licensePlate: `车牌号${i}`,
            engineCode: `engineCode-${i}`,
            transmissionSn: `transmissionSn-${i}`,
            productionDate: '2019-09-12T11:27:39.715Z',
            saleDate: '2019-09-12T11:27:39.715Z',
            status: 1,
            salesDealerCode: `salesDealerCode-${i}`,
            salesDealerName: `salesDealerName-${i}`,
            customerName: `customerName-${i}`,
            cellPhoneNumber: `400-8888-${i}`
        });
    res.json({
        message: '',
        payload: {
            content,
        }
    });
});

router.post('/import', async(req, res, next) => {
    const options = {
    };
    const data = {
        message: 'message'
    };
    res.json(data);
});

module.exports = router;
